void main() {
  Alipay alipay = Alipay();
  alipay.pay(10);

  Wechatpay wechatpay = Wechatpay();
  wechatpay.pay(20);

  Unionpay unionpay = Unionpay();
  unionpay.pay(30);
}

//抽象类-只负责定义，不负责实现
//不加abstract，就是一个普通类，就需要实现
abstract class Payment {
  void pay(double money);
}

//具体类-继承并实现抽象类
class Alipay implements Payment {
  @override //重写父类的方法
  void pay(double money) {
    print('支付宝支付了${money}元');
  }
}

class Wechatpay implements Payment {
  @override
  void pay(double money) {
    print('微信支付${money}元');
  }
}

class Unionpay implements Payment {
  @override
  void pay(double money) {
    print('银联支付${money}元');
  }
}
